<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
//         let ary01=[1,2,3,4,5]
// let ary02=[1,5]
// let ary03=[]
// for (var i = 0; i < ary01.length; i++) {
//           for (var j = 0; j < ary02.length; j++) {
//             if (ary01[i] == ary02[j]) {
//               ary01[i] = "";
//               break;
//             }
//           }
//         }
// console.log(ary01)//["",2,3,4,""]
         var i=0
         var newArr=[]


         var arr1=[{a:1,b:2},{a:1,b:2},{a:1,b:2},{a:1,b:3},{a:1,b:3},{a:1,b:2},{a:1,b:4}]

         
         var arr2=[{a:1,b:2},{a:1,b:2},{a:1,b:2},{a:1,b:3},{a:1,b:3},{a:1,b:4},{a:1,b:2}]
        
        //  for (var i = 0; i < arr1.length; i++) {
        //   for (var j = 0; j < arr2.length; j++) {
        //     if (arr1[i].a == arr2[j].a && arr1[i].b == arr2[j].b) {
        //       arr1[i] = "";
        //       break;
        //     }
        //   }
        // }
        // console.log(arr1)

          for (var i = 0; i < arr1.length; i++) {
          for (var j = i+1; j < arr1.length; j++) {
            if (arr1[i].a == arr1[j].a && arr1[i].b == arr1[j].b) {
              newArr.push(arr1[i])
              break;
            }
          }
        }
        console.log(newArr)
</script>
</html>